/**
  ******************************************************************************
  * @author     Chris
  * @since      2023/10/11 16:50
  *
  * @file       hd_lcd.h
  * @brief      Head file of TFT LCD Hardware Driver.
  *
  * @note       This file contains the hardware driver's function declaration
  *             for the  TFT LCD.
  *
  * @warning    None.
  ******************************************************************************
  * Change Logs:
  *   Date           Author       Notes
  *   2023/10/11     Chris        the first version
  *
  ******************************************************************************
  */

#ifndef JXTECH_HD_LCD_H
#define JXTECH_HD_LCD_H

#include "stm32g4xx.h"


#define USE_HORIZONTAL 2  //设置横屏或者竖屏显示 0或1为竖屏 2或3为横屏

#if USE_HORIZONTAL == 0 || USE_HORIZONTAL == 1
#define LCD_W 80
#define LCD_H 160
#else
#define LCD_W 160
#define LCD_H 80
#endif

/** LCD 显示的字体大小 */
#define HD_LCD_FONT_SIZE_12    12
#define HD_LCD_FONT_SIZE_16    16
#define HD_LCD_FONT_SIZE_24    24
#define HD_LCD_FONT_SIZE_32    32

/** LCD 显示的字体模式 */
#define HD_LCD_FONT_MODE_OVERLAY    0
#define HD_LCD_FONT_MODE_NO         1

/** LCD 显示的前景、背景色 */
#define WHITE           0xFFFF
#define BLACK           0x0000
#define BLUE            0x001F
#define BRED            0xF81F
#define GRED            0xFFE0
#define GBLUE           0x07FF
#define RED             0xF800
#define MAGENTA         0xF81F
#define GREEN           0x07E0
#define CYAN            0x7FFF
#define YELLOW          0xFFE0
#define BROWN           0xBC40  // 棕色
#define BRRED           0xFC07  // 棕红色
#define GRAY            0x8430  // 灰色
#define DARKBLUE        0x01CF  // 深蓝色
#define LIGHTBLUE       0x7D7C  // 浅蓝色
#define GRAYBLUE        0x5458  // 灰蓝色
#define LIGHTGREEN      0x841F  // 浅绿色
#define LGRAY           0xC618  // 浅灰色(PANNEL),窗体背景色
#define LGRAYBLUE       0xA651  // 浅灰蓝色(中间层颜色)
#define LBBLUE          0x2B12  // 浅棕蓝色(选择条目的反色)


void HD_LCD_Init(void);

void HD_LCD_Fill(uint16_t x, uint16_t y, uint16_t x1, uint16_t y1, uint16_t color);


void HD_LCD_SetFontSize(uint8_t size);

void HD_LCD_SetFontMode(uint8_t mode);

void HD_LCD_SetFontColor(uint16_t color);

void HD_LCD_SetFontBgColor(uint16_t color);


void HD_LCD_ShowChar(uint16_t x, uint16_t y, uint8_t chr);

void HD_LCD_ShowString(uint16_t x, uint16_t y, const uint8_t *str);

void HD_LCD_ShowUnsignedNum(uint16_t x, uint16_t y, uint32_t num, uint8_t len);

void HD_LCD_ShowSignedNum(uint16_t x, uint16_t y, int32_t num, uint8_t len);

void HD_LCD_ShowHexNum(uint16_t x, uint16_t y, uint32_t num, uint8_t len);

void HD_LCD_ShowBinNum(uint16_t x, uint16_t y, uint32_t num, uint8_t len);

void HD_LCD_ShowFloatNum(uint16_t x, uint16_t y, float num, uint8_t len);


void HD_LCD_DrawPoint(uint16_t x, uint16_t y, uint16_t color);

void HD_LCD_DrawLine(uint16_t x, uint16_t y, uint16_t x1, uint16_t y1, uint16_t color);

void HD_LCD_DrawRectangle(uint16_t x, uint16_t y, uint16_t x1, uint16_t y1, uint16_t color);

void HD_LCD_DrawCircle(uint16_t x, uint16_t y, uint8_t r, uint16_t color);


#endif  // JXTECH_HD_LCD_H
